package com.iflytek.jcy.supervise.job.web;

import com.alibaba.fastjson.JSONObject;
import com.iflytek.jcy.supervise.job.service.IBatchImportService;
import org.springframework.web.bind.annotation.*;

import com.iflytek.jcy.supervise.job.common.pojo.CommonResponse;
import com.iflytek.jcy.supervise.job.service.IModelMiningService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.Resource;

/**
 * <p>
 * 线索 前端控制器
 * </p>
 *
 * @author dgyu
 * @since 2022-10-20
 */
@RequestMapping("/job")
@Api(value = "任务接口", tags = { "任务接口" })
@RestController
public class JobController {
	private static final Logger logger = LoggerFactory.getLogger(JobController.class);

	@Autowired
	private IModelMiningService iModelMiningService;
	@Resource
	private IBatchImportService iBatchImportService;

	@PostMapping("/excute")
	@ApiOperation(value = "执行器调用传递任务id", notes = "执行器调用传递任务id")
	public CommonResponse excute(@RequestBody JSONObject JSONObject) throws Exception {
		this.iModelMiningService.doDataMinging(JSONObject);
		return CommonResponse.success();
	}

	@PostMapping("/importUap")
	@ApiOperation(value = "批量同步组织机构和用户", notes = "批量同步组织机构和用户")
	public CommonResponse importUap(String param) throws Exception {
		this.iBatchImportService.batchImport();
		return CommonResponse.success();
	}
}
